added iOS source code
[wl-app.git] / iOS / Pods / Target Support Files / Pods-WolneLektury / Pods-WolneLektury-resources.sh
1 #!/bin/sh
2 set -e
3 set -u
4 set -o pipefail
5
6 if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
7     # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
8     # resources to, so exit 0 (signalling the script phase was successful).
9     exit 0
10 fi
11
12 mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
13
14 RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
15 > "$RESOURCES_TO_COPY"
16
17 XCASSET_FILES=()
18
19 # This protects against multiple targets copying the same framework dependency at the same time. The solution
20 # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
21 RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
22
23 case "${TARGETED_DEVICE_FAMILY:-}" in
24   1,2)
25     TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
26     ;;
27   1)
28     TARGET_DEVICE_ARGS="--target-device iphone"
29     ;;
30   2)
31     TARGET_DEVICE_ARGS="--target-device ipad"
32     ;;
33   3)
34     TARGET_DEVICE_ARGS="--target-device tv"
35     ;;
36   4)
37     TARGET_DEVICE_ARGS="--target-device watch"
38     ;;
39   *)
40     TARGET_DEVICE_ARGS="--target-device mac"
41     ;;
42 esac
43
44 install_resource()
45 {
46   if [[ "$1" = /* ]] ; then
47     RESOURCE_PATH="$1"
48   else
49     RESOURCE_PATH="${PODS_ROOT}/$1"
50   fi
51   if [[ ! -e "$RESOURCE_PATH" ]] ; then
52     cat << EOM
53 error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
54 EOM
55     exit 1
56   fi
57   case $RESOURCE_PATH in
58     *.storyboard)
59       echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
60       ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
61       ;;
62     *.xib)
63       echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
64       ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
65       ;;
66     *.framework)
67       echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
68       mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
69       echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
70       rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
71       ;;
72     *.xcdatamodel)
73       echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
74       xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
75       ;;
76     *.xcdatamodeld)
77       echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
78       xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
79       ;;
80     *.xcmappingmodel)
81       echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
82       xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
83       ;;
84     *.xcassets)
85       ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
86       XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
87       ;;
88     *)
89       echo "$RESOURCE_PATH" || true
90       echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
91       ;;
92   esac
93 }
94
95 mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
96 rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
97 if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
98   mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
99   rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
100 fi
101 rm -f "$RESOURCES_TO_COPY"
102
103 if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ]
104 then
105   # Find all other xcassets (this unfortunately includes those of path pods and other targets).
106   OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
107   while read line; do
108     if [[ $line != "${PODS_ROOT}*" ]]; then
109       XCASSET_FILES+=("$line")
110     fi
111   done <<<"$OTHER_XCASSETS"
112
113   if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then
114     printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
115   else
116     printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist"
117   fi
118 fi